package com.pow.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.pow.entity.Permission;
import com.pow.service.PermissionService;
import com.pow.util.FenyeUtil;

@RequestMapping("/Permission")
@RestController
public class PermissionController {

	@Autowired
	private PermissionService permissionService;
	@GetMapping
	public FenyeUtil<Permission> GetPermissionByPage(Permission p,Integer page,Integer limit){
		return permissionService.findByPage(p, page, limit);
	}
	@PostMapping
	public String Add(Permission p) {
		return permissionService.AddAndUpd(p);
	}
	@PutMapping
	public String Upd(Permission p) {
		return permissionService.AddAndUpd(p);
	}
	@DeleteMapping
	public String DeleById(String id) {
		return permissionService.DeleteById(id);
	}
}
